#pragma once

#include "BaseInc.h"

typedef enum tag_stream_seek
{
	stream_seek_curr,
	stream_seek_begin,
	stream_seek_end,
	stream_seek_tell,
}stream_seek_e;

struct tag_base_stream;
typedef uint_32 (* base_stream_reader_func_t)(tag_base_stream * src, void * dst, uint_32 length);
typedef int_32 (* base_stream_seek_func_t)(tag_base_stream * src, int_32 length, stream_seek_e seek);

typedef TYPE_API struct tag_base_stream
{
	base_stream_reader_func_t reader;
	base_stream_seek_func_t seeker;
}base_stream_t;


typedef TYPE_API struct tag_byte_stream
{
	base_stream_t base;
	uint_8 * bytes;
	uint_32 length;
	uint_32 curr;
}byte_stream_t;

typedef TYPE_API struct tag_file_stream
{
	base_stream_t base;
	FILE * file;
}file_stream_t;

TYPE_API void create_byte_stream(byte_stream_t * stream, uint_8 * buffer, uint_32 length);
TYPE_API void create_file_stream(file_stream_t * stream, const char_x * file);
TYPE_API void destroy_file_stream(file_stream_t * stream);
